"""cyh URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path, re_path
from django.views.static import serve
# from preDepositLogs import urls as preUrls
from django.views.generic import TemplateView
from cyh.settings import MEDIA_ROOT
import xadmin
from users import urls as UserUrl
from goods import urls as GoodUrl
from orders import urls as OrderUrl
from preDepositLogs import urls as PreDepositLogUrl
from records import urls as recordUrl
from DjangoUeditor import urls as DjangoUeditor_urls
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token

urlpatterns = [
    path('', TemplateView.as_view(template_name='index.html')),
    path('select2/', include('django_select2.urls')),
    path('ueditor/', include(DjangoUeditor_urls)),
    # path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    path('api/token/', obtain_jwt_token),
    path('api/refresh/', refresh_jwt_token),
    # 处理图片显示的url,使用Django自带serve,传入参数告诉它去哪个路径找，我们有配置好的路径MEDIAROOT
    re_path('media/(?P<path>.*)', serve, {"document_root": MEDIA_ROOT}),
    # path('admin/', admin.site.urls),
    path('admin/', xadmin.site.urls),
    path('api/', include(UserUrl)),
    path('api/', include(GoodUrl)),
    path('api/', include(OrderUrl)),
    path('api/', include(PreDepositLogUrl)),
    path('api/', include(recordUrl))
]
